1. Field of the Invention
Embodiments of the present invention generally relate to computer graphics, and more particularly to filtering texture map data.
2. Description of the Related Art
Conventional graphics processors are exemplified by systems and methods developed to read data stored in texture maps, texels. Conventionally, texture maps are down-sampled to produce a sequence of mip maps, where each mip map is half the size, in each dimension, of the previous data array in the sequence. For example, a 16×8 image is down-sampled to produce an 8×4, 4×2, 2×1, and 1×1 sequence of mip map images.
Some graphics processors may be configured to generate down-sampled mip maps for images where each dimension is a power-of-two. Specifically, a dimension, n, that is a power-of-two may be expressed as n=2i, where i is an integer. More recently, graphics processors may read data from texture maps that have at least one dimension that is not a power-of-two. However, those same graphics processors are not able to generate down-sampled mip maps for those non-power-of-two dimension images.
FIG. 1A illustrates a prior art mapping of source image pixels in source image 100 to destination image pixels in destination image 110. Correct down-sampling of source image 100 to produce destination image 110 is straightforward since source image 100 and destination image 110 each have dimensions that are powers of two. Specifically, each pixel, e.g., pixel 101, pixel 102, pixel 103, and pixel 104, is scaled by 0.25 (25%) and summed to produce a single pixel, e.g., destination image 110.
Correct down-sampling of non-power-of-two dimension source images is more complicated since there is not a uniform mapping of pixels in the source image to pixels in the destination image. For example, naively using bilinear filtering to produce a destination pixel for every four source pixels undersamples the source image, resulting in a poor quality destination image.
FIG. 1B illustrates a prior art mapping of a 3×3 source image 120 to a 1×1 destination image 130. Bilinearly filtering pixels 111, 112, 114, and 115 of source image 120 produces an undersampled destination image 130. All nine pixels of source image 120 should be filtered to produce a correctly downsampled (high quality) destination image 130.
Accordingly, there is a need for efficient resizing of images, particularly for the generation of mip mapped texture maps based on non-power-of-two source images, to produce high quality downsampled images.